<?php
	if ($action['xpath']) {
		$targets = $xpath->query($action['xpath']);
	} else {
		$targets = array($tag);
	}
	
	$newNode = $dom->createDocumentFragment();
	$newNode->appendXML($this->php2cdata($actionXML));
	
	foreach($targets as $target) {
		if ($target->nextSibling != null) {
			$target->parentNode->insertBefore($newNode, $target->nextSibling);
		} else {
			$target->parentNode->appendChild($newNode);
		}
	}
	
	
?>